package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.DishFlavor;
import com.sky.enumeration.OperationType;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 口味表mapper
 */
@Mapper
public interface DishFlavorMapper {
    //@AutoFill(value = OperationType.INSERT)
    //这个表没有记录creat、update，因为是根据dish_id的附带表，不需要，
    // 而且dish表有，而且参数类型这个是列表类型，不能找到getset
    void insertBatch(List<DishFlavor> flavors);

    void deleteByDishIds(List<Long> dishIds);

    @Select("select * from dish_flavor where dish_id = #{dishId}")
    List<DishFlavor> getByDishId(Long dishId);

    void update(List<DishFlavor> flavors);

    @Delete("delete from dish_flavor where dish_id = #{dishId}")
    void deleteByDishId(Long dishId);
}
